package com.test.service;


import com.test.dao.TeaOperatDao;
import com.test.entity.StuAllInfoDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeaOperatService {
    @Autowired
    private TeaOperatDao teaOperatDao;

    public List<StuAllInfoDto> selectAllStu(StuAllInfoDto stuAllInfoDto,String identity){
        List<StuAllInfoDto> allstulist = teaOperatDao.selectAllStu(stuAllInfoDto,identity);
        for(int i = 0;i<allstulist.size();i++){
            String idcard  = allstulist.get(i).getStu_idcard();
            if(idcard!=null&&!"".equals(idcard)){
                String bornDate  = idcard.substring(6,14);
                String year = bornDate.substring(0,4);
                String mouth = bornDate.substring(4,6);
                String day = bornDate.substring(6,8);
                String bornDateStr = year+"-"+mouth+"-"+day;
                allstulist.get(i).setBornDate(bornDateStr);
            }
        }
        return  allstulist;
    }

    public int selectCompCount(){
        int result = teaOperatDao.selectCompCount();
        return result;
    }

    public int selectJobCount(){
        int result = teaOperatDao.selectJobCount();
        return result;
    }

}
